var $$BASE = 'http://localhost:8080/webapp';
var $$ADMIN = $$BASE + '/admin';
var API = {
    sys : {
        menu: {
            list  : $$ADMIN + '/sys/menu/list',
            get   : function (id) {
                return $$ADMIN + '/sys/menu/' + id;
            },
            save  : $$ADMIN + '/sys/menu/save',
            remove: function (id) {
                return $$ADMIN + '/sys/menu/remove/' + id;
            }
        },
        user: {
            page  : $$ADMIN + '/sys/user/page',
            get   : function (id) {
                return $$ADMIN + '/sys/user/' + id;
            },
            update: $$ADMIN + '/sys/user/update',
            create: $$ADMIN + '/sys/user/create',
            remove: function (id) {
                return $$ADMIN + '/sys/user/remove/' + id;
            },
            pass  : {
                update: function (id) {
                    return $$ADMIN + '/sys/user/' + id + '/pass/update';
                },
                reset : function (id) {
                    return $$ADMIN + '/sys/user/' + id + '/pass/reset';
                }
            },
            wechat: $$BASE + '/sys/user/wechat'
        }
    },
    wct : {
        menu    : {
            get     : $$ADMIN + '/wct/menu/get',
            oauthUrl: $$ADMIN + '/wct/menu/oauthurl',
            clear   : $$ADMIN + '/wct/menu/clear',
            save    : $$ADMIN + '/wct/menu/save',
            sync    : $$ADMIN + '/wct/menu/sync'
        },
        user    : {
            page: $$ADMIN + '/wct/user/page',
            sync: $$ADMIN + '/wct/user/sync',
            send: $$ADMIN + '/wct/user/send'
        },
        template: {
            page    : $$ADMIN + '/wct/template/page',
            get     : function (id) {
                return $$ADMIN + '/wct/template/' + id;
            },
            save    : $$ADMIN + '/wct/template/save',
            sync    : $$ADMIN + '/wct/template/sync',
            saveNews: $$ADMIN + '/wct/template/news',
            remove  : function (id) {
                return $$ADMIN + '/wct/template/remove/' + id;
            },
            articles: function (id) {
                return $$ADMIN + '/wct/template/' + id + '/articles';
            }
        },
        article : {
            page  : $$ADMIN + '/wct/article/page',
            save  : $$ADMIN + '/wct/article/save',
            remove: function (id) {
                return $$ADMIN + '/wct/article/remove/' + id;
            }
        },
        reply   : {
            page  : $$ADMIN + '/wct/reply/page',
            get   : function (id) {
                return $$ADMIN + '/wct/reply/' + id;
            },
            save  : $$ADMIN + '/wct/reply/save',
            remove: function (id) {
                return $$ADMIN + '/wct/reply/remove/' + id;
            }
        },
        account : {
            find  : $$ADMIN + '/wct/account/find',
            get   : function (id) {
                return $$ADMIN + '/wct/account/' + id;
            },
            page  : $$ADMIN + '/wct/account/page',
            save  : $$ADMIN + '/wct/account/save',
            remove: function (id) {
                return $$ADMIN + '/wct/account/remove/' + id;
            }
        }
    },
    auth: {
        login : $$BASE + '/login',
        logout: $$BASE + '/logout'
    },
    role: {
        child: function (upId) {
            return $$ADMIN + '/admin/org/' + upId + '/child';
        }
    }
};
if (typeof angular !== 'undefined') {
    angular && angular.module('app').constant('Api', API);
}